package com.zhaoyan.okgorxjavademo.presenter;



import com.zhaoyan.okgorxjavademo.base.BasePresenter;
import com.zhaoyan.okgorxjavademo.base.BaseView;

import javax.inject.Inject;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

/**
 * Created by cxy on 2017/9/13.
 */

public class RxPresenter<T extends BaseView> implements BasePresenter<T> {
    @Inject
    protected T mView;
    protected CompositeDisposable mCompositeDisposable;

    protected void unSubscribe() {
        if (mCompositeDisposable != null) {
            mCompositeDisposable.clear();
        }
    }

    protected void addSubscribe(Disposable subscription) {
        if (mCompositeDisposable == null) {
            mCompositeDisposable = new CompositeDisposable();
        }
        mCompositeDisposable.add(subscription);
    }

    @Override
    public void attachView(T view) {

    }

    @Override
    public void detachView() {

    }
}
